#!/bin/bash
#
#$ -cwd
#$ -j y
#$ -S /bin/bash
#
cd /home/tberg/iris/testdata


SENSOR_ROOT=$1
TARGET=eval/$1
SRC=res/$1

if [ $# -ne 1 ]; then
	echo 'You have to provide the sensor root in order to run all tests...';
	exit;
fi

#SENSOR_ROOT=sensor1
rm -rf $TARGET
mkdir -p $TARGET

AGES="1460 2920 4380  5840  7300  8760 10220  11680  13140  14600  16060  17520  18980  20440  21900  23360  24820  26280  27740 29200  30660  32120  33580  35040"
DOWNSCALE=2

COUNT=0
for age in $AGES
do
	((COUNT++))

	if [ $COUNT -ne $DOWNSCALE ]; then
		echo 'Ignore age ' $age
	else
#	        qsub ./ipRunTests.sh $age $SENSOR_ROOT 
		echo 'RUNNING FOR AGE: ' $age



		FILES=`ls $SRC/$age/dist`
		#echo $FILES 

		for distances in $FILES
		do
			java -jar agingEval.jar $SRC/$age/dist/$distances $age $TARGET/${distances/.txt/.eer}.csv
		done


		COUNT=0
		#qsub ./test.sh $age $SENSOR_ROOT
	fi
done





